home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 4
/
Aminet 4 - November 1994.iso
/
aminet
/
dev
/
obero
/
oberon_lib.lha
/
oberon-a
/
source1.lha
/
source
/
Amiga
/
Config.mod
< prev
next >
Wrap
Text File
|
1994-08-08
|
12KB
|
345 lines
(***************************************************************************
$RCSfile: Config.mod $
Description: Interface to expansion.library
Created by: fjc (Frank Copeland)
$Revision: 3.2 $
$Author: fjc $
$Date: 1994/08/08 00:46:19 $
Includes Release 40.15
(C) Copyright 1985-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A interface Copyright © 1994, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
***************************************************************************)
MODULE Config;
(*
** $C- CaseChk $I- IndexChk $L+ LongAdr $N- NilChk
** $P- PortableCode $R- RangeChk $S- StackChk $T- TypeChk
** $V- OvflChk $Z- ZeroVars
*)
IMPORT E := Exec;
(*
** $VER: configregs.h 36.13 (15.2.91)
**
** AutoConfig (tm) hardware register and bit definitions
*)
(*
** AutoConfig (tm) boards each contain a 32 byte "ExpansionRom" area that is
** read by the system software at configuration time. Configuration of each
** board starts when the ConfigIn* signal is passed from the previous board
** (or from the system for the first board). Each board will present it's
** ExpansionRom structure at location $00E80000 to be read by the system.
** This file defines the appearance of the ExpansionRom area.
**
** Expansion boards are actually organized such that only one nybble per
** 16 bit word contains valid information. The low nybbles of each
** word are combined to fill the structure below. (This table is structured
** as LOGICAL information. This means that it never corresponds exactly
** with a physical implementation.)
**
** The ExpansionRom space is further split into two regions: The first 16
** bytes are read-only. Except for the ertype field, this area is inverted
** by the system software when read in. The second 16 bytes contain the
** control portion, where all read/write registers are located.
**
** The system builds one "ConfigDev" structure for each board found. The
** list of boards can be examined using the expansion.library/FindConfigDev
** function.
**
** A special "hacker" Manufacturer ID number is reserved for test use:
** 2011 ($7DB). When inverted this will look like $F824.
*)
TYPE
ExpansionRomPtr * = CPOINTER TO ExpansionRom;
ExpansionRom * = RECORD
type * : E.BSET; (* Board type, size and flags *)
product * : E.UBYTE; (* Product number, assigned by manufacturer *)
flags * : E.BSET; (* Flags *)
reserved03 * : E.UBYTE; (* Must be zero ($ff inverted) *)
manufacturer * : E.UWORD; (* Unique ID,ASSIGNED BY COMMODORE-AMIGA! *)
serialNumber * : E.ULONG; (* Available for use by manufacturer *)
initDiagVec * : E.UWORD; (* Offset to optional "DiagArea" structure *)
reserved0c * : E.UBYTE;
reserved0d * : E.UBYTE;
reserved0e * : E.UBYTE;
reserved0f * : E.UBYTE;
END; (* ExpansionRom *)
(*
** Note that use of the ecBaseAddress register is tricky. The system
** will actually write twice. First the low order nybble is written
** to the ecBaseAddress register+2 (D15-D12). Then the entire byte is
** written to ecBaseAddress (D15-D8). This allows writing of a byte-wide
** address to nybble size registers.
*)
TYPE
ExpansionControlPtr * = CPOINTER TO ExpansionControl;
ExpansionControl * = RECORD
interrupt * : E.BSET; (* Optional interrupt control register *)
z3HighBase * : E.UBYTE; (* Zorro III : Config address bits 24-31 *)
baseAddress * : E.UBYTE; (* Zorro II/III: Config address bits 16-23 *)
shutup * : E.UBYTE; (* The system writes here to shut up a board *)
reserved14 * : E.UBYTE;
reserved15 * : E.UBYTE;
reserved16 * : E.UBYTE;
reserved17 * : E.UBYTE;
reserved18 * : E.UBYTE;
reserved19 * : E.UBYTE;
reserved1a * : E.UBYTE;
reserved1b * : E.UBYTE;
reserved1c * : E.UBYTE;
reserved1d * : E.UBYTE;
reserved1e * : E.UBYTE;
reserved1f * : E.UBYTE;
END; (* ExpansionControl *)
(*
** many of the constants below consist of a triplet of equivalent
** definitions: xxMASK is a bit mask of those bits that matter.
** xxBIT is the starting bit number of the field. xxSIZE is the
** number of bits that make up the definition. This method is
** used when the field is larger than one bit.
**
** If the field is only one bit wide then the xxBxx and xxFxx convention
** is used (xxBxx is the bit number, and xxFxx is mask of the bit).
*)
CONST
(* manifest constants *)
slotSize * = 10000H;
slotMask * = 0FFFFH;
slotShift * = 16;
(* these define the free regions of Zorro memory space.
** THESE MAY WELL CHANGE FOR FUTURE PRODUCTS!
*)
expansionBase * = 00E80000H; (* Zorro II config address *)
z3ExpansionBase * = 0FF000000H; (* Zorro III config address *)
expansionSize * = 00080000H; (* Zorro II I/O type cards *)
expansionSlots * = 8;
memoryBase * = 00200000H; (* Zorro II 8MB space *)
memorySize * = 00800000H;
memorySlots * = 128;
z3ConfigArea * = 40000000H; (* Zorro III space *)
z3ConfigAreaEnd * = 7FFFFFFFH; (* Zorro III space *)
z3SizeGranularity * = 00080000H; (* 512K increments *)
(**** erType definitions (ttldcmmm) ***************************************)
CONST
(* erType board type bits -- the OS ignores "old style" boards *)
ertTypeMask * = {6, 7}; (* Bits 7-6 *)
ertTypeBit * = 6;
ertTypeSize * = 2;
ertNewBoard * = {6, 7};
ertZorroII * = ertNewBoard;
ertZorroIII * = {7};
(* other bits defined in erType *)
ertMemList * = 5; (* Link RAM into free memory list *)
ertDiagValid * = 4; (* ROM vector is valid *)
ertChainedConfig * = 3; (* Next config is part of the same card *)
(* erType field memory size bits *)
ertMemMask * = {0..2}; (* Bits 2-0 *)
ertMemBit * = 0;
ertMemSize * = 3;
(**** erFlags byte -- for those things that didn't fit into the type byte ****)
(**** the hardware stores this byte in inverted form ****)
CONST
erfMemSpace * = 7; (* Wants to be in 8 meg space. *)
(* (NOT IMPLEMENTED) *)
erfNoShutup * = 6; (* Board can't be shut up *)
erfExtended * = 5; (* Zorro III: Use extended size table *)
(* for bits 0-2 of erType *)
(* Zorro II : Must be 0 *)
erfZorroIII * = 4; (* Zorro III: must be 1 *)
(* Zorro II : must be 0 *)
ertZ3SSMask * = {0..3}; (* Bits 3-0. Zorro III Sub-Size. How *)
ertZ3SSBit * = 0; (* much space the card actually uses *)
ertZ3SSSize * = 4; (* (regardless of config granularity) *)
(* Zorro II : must be 0 *)
(* ecInterrupt register (unused) ********************************************)
CONST
eciIntena * = 1;
eciReset * = 3;
eciInt2Pend * = 4;
eciInt6Pend * = 5;
eciInt7Pend * = 6;
eciInterrupting * = 7;
(***************************************************************************
**
** these are the specifications for the diagnostic area. If the Diagnostic
** Address Valid bit is set in the Board Type byte (the first byte in
** expansion space) then the Diag Init vector contains a valid offset.
**
** The Diag Init vector is actually a word offset from the base of the
** board. The resulting address points to the base of the DiagArea
** structure. The structure may be physically implemented either four,
** eight, or sixteen bits wide. The code will be copied out into
** ram first before being called.
**
** The daSize field, and both code offsets (daDiagPoint and daBootPoint)
** are offsets from the diag area AFTER it has been copied into ram, and
** "de-nibbleized" (if needed). (In other words, the size is the size of
** the actual information, not how much address space is required to
** store it.)
**
** All bits are encoded with uninverted logic (e.g. 5 volts on the bus
** is a logic one).
**
** If your board is to make use of the boot facility then it must leave
** its config area available even after it has been configured. Your
** boot vector will be called AFTER your board's final address has been
** set.
**
****************************************************************************)
TYPE
DiagAreaPtr * = CPOINTER TO DiagArea;
DiagArea * = RECORD
config * : E.UBYTE; (* see below for definitions *)
flags * : E.BSET; (* see below for definitions *)
size * : E.UWORD; (* the size (in bytes) of the total diag area *)
diagPoint * : E.UWORD; (* where to start for diagnostics, or zero *)
bootPoint * : E.UWORD; (* where to start for booting *)
name * : E.UWORD; (* offset in diag area where a string *)
(* identifier can be found (or zero if no *)
(* identifier is present). *)
reserved01 * : E.UWORD; (* two words of reserved data. must be zero. *)
reserved02 * : E.UWORD;
END; (* DiagArea *)
(* daConfig definitions *)
(*
** dacByteWide can be simulated using dacNibbleWide.
*)
CONST
dacBusWidth * = 0C0X; (* two bits for bus width *)
dacNibbleWide * = 00X;
dacByteWide * = 40X; (* BUG: Will not work under V34 Kickstart! *)
dacWordWide * = 80X;
dacBootTime * = 30X; (* two bits for when to boot *)
dacNever * = 00X; (* obvious *)
dacConfigTime * = 10X; (* call daBootPoint when first configing *)
(* the device *)
dacBindTime * = 20X; (* run when binding drivers to boards *)
(*
**
** These are the calling conventions for the diagnostic callback
** (from daDiagPoint):
**
** A7 -- points to at least 2K of stack
** A6 -- ExecBase
** A5 -- ExpansionBase
** A3 -- your board's ConfigDev structure
** A2 -- Base of diag/init area that was copied
** A0 -- Base of your board
**
** Your board must return a value in D0. If this value is NULL, then
** the diag/init area that was copied in will be returned to the free
** memory pool.
*)
(*
** $VER: configvars.h 36.14 (22.4.91)
**
** Software structures used by AutoConfig (tm) boards
*)
(*
** At early system startup time, one ConfigDev structure is created for
** each board found in the system. Software may seach for ConfigDev
** structures by vendor & product ID number. For debugging and diagnostic
** use, the entire list can be accessed. See the expansion.library document
** for more information.
*)
TYPE
ConfigDevPtr * = CPOINTER TO ConfigDev;
ConfigDev * = RECORD (E.Node)
cdFlags * : E.BSET; (* (read/write) *)
pad : E.UBYTE; (* reserved *)
rom * : ExpansionRom; (* copy of board's expansion ROM *)
boardAddr * : E.APTR; (* where in memory the board was placed *)
boardSize * : E.ULONG; (* size of board in bytes *)
slotAddr : E.UWORD; (* which slot number (PRIVATE) *)
slotSize : E.UWORD; (* number of slots (PRIVATE) *)
driver * : E.APTR; (* pointer to node of driver *)
nextCD * : ConfigDevPtr; (* linked list of drivers to config *)
unused : ARRAY 4 OF E.ULONG; (* for whatever the driver wants *)
END; (* ConfigDev *)
CONST
(* cdFlags *)
cdShutup * = 0; (* this board has been shut up *)
cdConfigMe * = 1; (* this board needs a driver to claim it *)
cdBadMemory * = 2; (* this board contains bad memory *)
(*
** Boards are usually "bound" to software drivers.
** This structure is used by GetCurrentBinding() and SetCurrentBinding()
*)
TYPE
CurrentBindingPtr * = CPOINTER TO CurrentBinding;
CurrentBinding * = RECORD
configDev * : ConfigDevPtr; (* first configdev in chain *)
fileName * : E.STRPTR; (* file name of driver *)
productString * : E.STRPTR; (* product # string *)
toolTypes * : E.APTR; (* tooltypes from disk object *)
END; (* CurrentBinding *)
END Config.